home *** CD-ROM | disk | FTP | other *** search
- /* VCheck.rexx */
- /*****************************************************************************
- SETUP:
-
- To set up the ARexx Gadget Program Control set:
- Check the following selections:
- Skip selected directories
- Skip selected files
- Work without selected items
- Skip .info files
- Title string gadget
- LhaVCheck (or whatever you wish to call it)
- Path and Program name
- Odds&ends:MegaD/rexx/LhaVCheck.rexx (or where ever you have it placed)
-
- Add the new ARexx Gadget to a Keypad Gadget, Gadget Set Gadget or give
- it a Hot Key definition so it may be called.
-
- Once this is done you will need to modify these variables in this script:
- LhaProgram = where your executable Lha is on your system
- VCheckProgram = Where your executable Virus_Checker is on your system
-
- USAGE:
-
- Within MegaD,
- Open a directory window to the files you wish to unarc.
- Open a directory window for where you wish to unarc the files to.
- Make sure that the 'Dest'ination gadget is selected in the destination
- window
- Call LhaVCheck by use of the Gadget or Hot key you specified earlier.
- ******************************************************************************/
-
- if ~show("L","rexxsupport.library") then call addlib"rexxsupport.library",0,-30
-
- OPTIONS RESULTS
-
- TRACE INTERMIDIATS
-
- address MEGAD
- dbug TRUE
-
-
- /* change the following to where Lha is located on your system */
- LhaProgram = 'Odds&ends:commands/LHA'
-
- VCheckProgram = 'Odds&ends:VCheck/Virus_Checker'
- VCheckPort = 'Virus_Checker'
-
- LhaGadgetName = 'LhaUnPackTemp'
-
- /* get the active directory from MegaD */
- ActiveDir
- destDir = result
- IF destDir = "" THEN DO
- call close 'STDOUT'
- call open 'STDOUT','con:0/12/640/100/MegaD Error/SCREEN MEGAD', 'W'
- SAY "No Destination directory returned from MegaD"
- SAY "Exiting"
- Call delay(300)
- EXIT
- END
-
- /* create a User Gadget to call to unarc the the .lha files */
- AddProCtrl UserGadget "SkipDir|SkipInfo|ReloadDir" MDScreen Execute (LhaGadgetName) (LhaProgram) "'e'" NULL NULL NULL NULL NULL NULL NULL NULL
-
- /* call the UserGadget */
- LhaGadgetName
-
- /* we need to get a count of bytes in the Destination window to use for
- a test later */
- /* There is no Select 'Dest'ination command the below
- becomes an equivalent though */
-
-
- DelProCtrl LhaGadgetName
-
- /* make sure Virus Checker is running */
- IF ~SHOW("P",VCheckPort) THEN DO
- ADDRESS COMMAND 'run ' || (VCheckProgram)
- ADDRESS COMMAND 'WaitForPort ' || (VCheckPort)
- END
-
- /*
- We need a test to see when Lha is done, MegaD will update the 'Dest'ination
- directory once it exits. By taking a count of the files in the 'Dest'ination
- directory at start and then compairing it for a change we can tell when it is
- time to go onto the next part of the script.
- */
-
- ADDRESS MEGAD
- kill = 100 /* just incase Lha does not produce any files for us */
- SelectAll
- ClrSrc
- AllBytes
- startBytes = result
- endBytes = startBytes
- do while endBytes == startBytes
- Call Delay(200)
- SelectAll
- ClrSrc
- AllBytes
- endBytes = result
- kill = kill - 1
- if kill = 0 then exit
- END
-
- /* leave all 'Dest'ination directory items selected */
- SelectAll
- ClrSrc
-
- /* Get the path from the first selected item */
- NextItem Path
- destDir = result
-
- if destDir = "" then do
- call close 'STDOUT'
- call open 'STDOUT','con:0/12/640/100/MegaD Error/SCREEN MEGAD', 'W'
- SAY "could not get the 'Dest'ination directory"
- SAY "Exiting"
- Call delay(400)
- EXIT
- END
-
- /* Clear all selected items */
- ClearAll
-
- /* now talk to Virus Check */
- address (VCheckPort)
- 'checkdrive\' || destDir
-
-